<template>
        <rx-layout>
            <template v-slot:center>
                <rx-grid ref="rxGrid" :queryParam="queryParam" :url="'/api-bpm/bpm/core/bpmPendingRecord/query'">
                    <template v-slot:center="{record}">
                        <view class="rx-center">
                            <view class="rx-createTime">
                                <my-icon style="color: rgba(66, 133, 244, 1);font-size: 1.2rem"
                                         type="icon-linetime"></my-icon>
                                <view class="rx-createTime-name">{{record.createTime}}</view>
                            </view>
                            <view class="rx-top">
                                <view class="rx-icon-le"><view class="rx-icon_liucheng"><my-icon type="icon-Vue3jpaas-icon_liucheng"></my-icon></view></view>
                                <view class="rx-subject">{{ record.taskName }}</view>
                            </view>
                            <view class="rx-bottom">
                                <view class="rx-bottom-list">
                                    <span class="rx-bottom-span">{{ i18n('pendLink', '挂起环节') }}:</span>
                                    <span class="rx-bottom-name">{{ record.createByName }}</span>
                                </view>
                            </view>
                            <view class="rx-operate" v-if="!record.endTime">
                                <view class="rx-operate-button" @click.stop="bpmDetails(record,'edit')">
                                    <my-icon type="icon-bianjiwenzhang_huaban"></my-icon>
                                    {{ i18n('handle', '办理') }}
                                </view>
                            </view>
                            <view class="rx-operate" v-else>
                                <view class="rx-operate-button"  @click="bpmDetails(record,'detail')">
                                    {{i18n('detailBtn','明细')}}
                                </view>
                            </view>
                        </view>
                    </template>
                </rx-grid>
            </template>
        </rx-layout>
</template>

<script>
import RxGrid from '@/components/RxGrid'
import RxLayout from '@/components/RxLayout'

export default {
    name: "RxMyPending",
    components: {RxGrid, RxLayout},
    data() {
        return {
            queryParam: {
                Q_CREATE_BY__S_EQ: ""
            },//筛选参数
        }
    },
    created(){
        this.queryParam.Q_CREATE_BY__S_EQ =  uni.getStorageSync("user").userId;
    },
    onShow(){
        if(this.$refs.rxGrid){
            this.$refs.rxGrid.getInit(true, true);
        }
    },
    methods: {
        i18n(name, text, key) {
            return this.$ti18(name, text, "bpmLang", key);
        },
        bpmDetails(obj, action) {
            let params = {
                instId: obj.instId,
                routerName: 'openDoc',
                action: action
            }
            if (obj.taskId && action=='edit') {
                this.$set(params, 'taskId', obj.taskId)
            }
            let mobileAppId = uni.getStorageSync("mobileAppId");
            let appId =''
            if(obj.appId){
                appId=obj.appId?obj.appId:mobileAppId
            }
            uni.navigateTo({
                url: '/views/modules/bpm/OpenDoc?params=' + JSON.stringify(params)+'&appId='+appId
            })

        },
    }
}
</script>

<style scoped>
@import "../RxProcessManagement.css";
</style>
